package com.teamwings.common.constant;

/**
 * 表单常量
 */
public interface FormConstant {

	String FORM_HEAD_PAGING = "form:head:listPage";

	String FORM_HEAD_HEAD = "form:head:head";

	String FORM_HEAD_COLUMN = "form:head:headColumn";

	String FORM_HEAD_NAME = "form:head:name";

	/**
	 * 根据版本查找代码
	 */
	String FORM_HEAD_CODE = "form:head:code";

	String FORM_CATE_PAGING = "form:cate:listPage";

	String FORM_CATE_TREE_SYNC = "form:cate:cateTreeSync";

	String FORM_DESIGN_HEAD = "form:design:head";

	String FORM_DESIGN_PAGING = "form:design:listPage";

	String FORM_PAGE_SHOW = "form:page:show";

	/**
	 * 触发
	 */
	enum TRIGGER_TYPE {
		// 页面show入口
		PAGE_SHOW,
		// 控件默认功能
		CTRL_HANDLER
	}

	enum TABLE_SOURCE {
		/**
		 * 是
		 */
		AUTO("0", "自动"),
		/**
		 * 无数据源
		 */
		NONE("1", "无数据源"),
		/**
		 * 否
		 */
		EXTERNAL("2", "外部数据源");

		private final String code;
		private final String text;

		TABLE_SOURCE(String code, String text) {
			this.code = code;
			this.text = text;
		}

		public String getCode() {
			return code;
		}
		public String getText() {
			return text;
		}
	}

	// 页面显示时需要加载的控件方法
	String[] FORM_TRIGGER_SHOW = new String[]{"fn_view_count"};

	enum LOGIC_TABLE_TYPE {
		/**
		 * sql模式
		 */
		SQL("sql"),
		/**
		 * 单表模式
		 */
		SINGLE_TABLE("singleTable"),
		/**
		 * 接口模式
		 */
		API("api");

		private final String text;

		LOGIC_TABLE_TYPE(String text) {
			this.text = text;
		}

		public String getText() {
			return text;
		}
	}
}
